import homeApi from '../pages/home/service/home.service.js'
import messageApi from '../pages/message/service/message.service.js'
import personalApi from '../pages/personal/service/personal.service.js'
const install = Vue => {
	const http = uni.$u.http
	// 获取字典表信息
	let getClassifyInfo = (params) => http.get('/v1_0/home/classify/index', params)
	// 获取海报模板列表
	let getTplindexList = (params) => http.get('/v1_0/home/poster/getTplindexList', params)
	// 生成海报
	let getPosterGenerate = (params) => http.get('/v1_0/home/poster/index', params, {
		custom: {
			auth: true
		}
	})

	// 获取隐私政策及用户协议
	let getAgreementAndPrivacy = (params) => http.get('/v1_0//home/config/agreementAndPrivacy', params)

	// 获取用户信息
	let getUserInfo = (params) => http.get('/v1_0/home/config/userinfo', params)
	//消息列表
	let msglist = (params, config = {}) => http.get('/v1_0/member/account/msglist', params, config)
	//用户刷新简历
	let refresh = (params) => http.post('/v1_0/personal/resume/refresh', params)
	//个人中心数据统计
	let manageIndex = (params) => http.post('/v1_0/personal/index/index', params)

	// 用户在线简历数据
	let getOnlineMange = (params) => http.get('/v1_0/personal/resume/detail', params)
	// 新增作品照片
	let getWorksSave = (config = {}) => http.upload('/v1_0/personal/resume/imgAdd', config)
	// 删除作品照片
	let getWorksDel = (params, config = {
		custom: {
			loading: true
		}
	}) => http.post('/v1_0/personal/resume/imgDelete', params, config)
	// 修改求职状态
	let getCurrentSave = (params) => http.post('/v1_0/personal/resume/currentSave', params)

	// 上传图片/文件
	let getUploadSave = (params, config = {
		custom: {
			loading: true
		}
	}) => http.upload('/v1_0/member/upload/index', params, config)
	// 更新企业信息
	let getCompanyInfoSave = (params, config = {
		custom: {
			loading: true
		}
	}) => http.post('/v1_0/company/profile/updateField', params, config)

	// 编辑用户个人信息头像
	let uploadPhoto = (params, config = {
		custom: {
			loading: true
		}
	}) => http.upload('/v1_0/personal/resume/uploadPhoto', params, config)
	//用户简历基础信息编辑
	let updateUserInfo = (params, config = {
		custom: {
			loading: true
		}
	}) => http.post('/v1_0/personal/resume/basicSave', params, config)

	// 获取验证码
	let getPhoneCode = (params, config = {}) => http.post('/v1_0/member/sendsms/login', params, config)
	// 验证码登录
	let getPhoneLogin = (params, config = {}) => http.post('/v1_0/member/login/code', params, config)
	// 账号密码登录
	let getPasswordLogin = (params, config = {}) => http.post('/v1_0/member/login/password', params, config)
	// 微信登录
	let getWxLogin = (params, config = {}) => http.post('/v1_0/member/login/weixin', params, config)
	uni.$u.api = {
		getClassifyInfo,
		getTplindexList,
		getPosterGenerate,
		getAgreementAndPrivacy,
		getUserInfo,
		msglist,
		refresh,
		manageIndex,
		getOnlineMange,
		getWorksSave,
		getWorksDel,
		getCurrentSave,
		getUploadSave,
		getCompanyInfoSave,
		uploadPhoto,
		updateUserInfo,
		getPhoneCode,
		getPhoneLogin,
		getPasswordLogin,
		getWxLogin
	}
	// 首页API
	homeApi(Vue)
	// 聊天API
	messageApi(Vue)
	//我的页面
	personalApi(Vue)


}
export default {
	install

};